#include "chardev.h"

#include <fcntl.h>                /* open */
#include <unistd.h>                /* exit */
#include <sys/ioctl.h>                /* ioctl */
#include <stdio.h>
#include <stdlib.h>

main()
{
        int file_desc, ret_val;
				char msg[1024];

        file_desc = open("/dev/char_dev", 0);
        if (file_desc < 0) {
                printf("Can't open device file: %s\n", DEVICE_FILE_NAME);
                exit(-1);
        }
				printf("before read\n");
				int len = read(file_desc, msg, sizeof(msg));
				int i;
				printf("len:%d\n", len);
				for(i = 0; i < len; i+=2)
					printf("id=%d, rssi=%d\n",0x00ff & msg[i], 0x00ff & msg[i+1]);

        close(file_desc);
}
